package org.langqiao.exception;

public class RuntimeExceptionTest {
	public static void main(String[] args) {
		//testArithmeticException();
		//testClassCastException();
		testNegativeAarraySizeException();
	}
	
	//算数异常ArithmeticException
	public static void testArithmeticException(){
		//System.out.println("" + (3/0));
		System.out.println("" + (3/0.00));
	}
	
	//空指针异常NUllPointerException
	public static void testNullPointerException(){
		int a[] = null;
		//a[0] = 1;
		String str = null;
		System.out.println(str.length());
	}
	
	//类型强制转化异常ClassCastException
	public static void testClassCastException(){
		Object obj = new Object();
		String str = (String)obj;
	}
	
	//负数组长度异常NegativeArraySizeException
	public static void testNegativeAarraySizeException(){
		int a[] = new int[-1];
	}
}
